package org.vectrics.mail;

import javax.mail.internet.MimeMessage;
import javax.mail.*;
import org.apache.log4j.Logger;

class MailSenderThread extends Thread {
	private transient static Logger log = Logger.getLogger(MailSenderThread.class);
	private MimeMessage message = null;

	public MailSenderThread(MimeMessage message) {
		super();
		this.message = message;
	}


	public void run() {
		try {
			log.info("sendMessage() - sending e-mail: " + message.getSubject());
			Transport.send(message);
		}
		catch (Exception ex) {
			try {
				log.error("Exception sending message. Subject = " + message.getSubject(), ex);
			}
			catch (Exception e) {
				log.error("Exception displaying message sending exception");
			}
		}
		
	}
}
